#! /usr/bin/env python

import roslib; roslib.load_manifest('storage')
import rospy
import sqlite3
import actionlib
import roslib.scriptutil
from storage.msg import *

if __name__ == '__main__':
	#Message Layout:
	#goal.target[0] is to say whether you are getting or setting in the db
	#"get" or "set"
	
	#goal.target[1] is to say which table you are interacting with
	#"mainBio" or "peopleDictionary"
	
	#the remaing string array gives the rest of the appropriate information if you are setting
	#for setting to biometric table this would mean
	#imageID, personId(null?), height, faceR, faceG, faceB, shirtR, shirtG, shirtB
	#for setting to people table this would mean
	#name, height, faceR, faceG, faceB, shirtR, shirtG, shirtB
	
	#example
	rospy.init_node("storageClient3")
	client = actionlib.SimpleActionClient("addPerson",addPersonAction)
	client.wait_for_server()
	goal=addPersonGoal()
	
	
	#get or set
	goal.target.append("set")
	#table
	goal.target.append("mainBio")
	#imageID
	goal.target.append("18")
	#personID
	goal.target.append("NULL")
	#height
	goal.target.append("2.57")
	#faceR
	goal.target.append("189")
	#faceG
	goal.target.append("25")
	#faceB
	goal.target.append("53")
	#shirtR
	goal.target.append("122")
	#shirtG
	goal.target.append("250")
	#shirtB
	goal.target.append("12")
	
	client.send_goal(goal)
	client.wait_for_result()
	
	client = actionlib.SimpleActionClient("addPerson",addPersonAction)
	client.wait_for_server()
	goal=addPersonGoal()
	goal.target.append("get")
	goal.target.append("mainBio")
	client.send_goal(goal)
	client.wait_for_result()
	res = client.get_result()
	for i in range(len(res.result)):
		rospy.loginfo(res.result[i])
